home *** CD-ROM | disk | FTP | other *** search
/ CICA 1993 April / CICA MS Windows - April 1993.iso / unzipped / programr / tp / printbmp / printbmp.pas < prev    next >
Pascal/Delphi Source File  |  1991-10-28  |  2KB  |  67 lines

  1. {************************************************}
  2. {                                                }
  3. {   Turbo Pascal for Windows                     }
  4. {   Tips & Techniques Demo Program               }
  5. {   Copyright (c) 1991 by Borland International  }
  6. {                                                }
  7. {************************************************}
  8.  
  9.  
  10.  
  11. Program MyBitmapPrinter;
  12.  
  13. uses WObjects, WinProcs, WinTypes, hCopy;
  14.  
  15. {$R printbmp}
  16.  
  17. const
  18.   id_Print = 101;
  19.  
  20. type
  21.   TMyApplication = object(TApplication)
  22.     procedure InitMainWindow; virtual;
  23.   end;
  24.  
  25.   PMyWIndow = ^TMyWindow;
  26.   TMyWindow = object(TWindow)
  27.     constructor Init(AParent: PWindowsObject; ATitle: PChar);
  28.     procedure GetWindowClass(var AWndClass : TWndClass); virtual;
  29.     procedure PrintIT(var Msg : TMessage); virtual cm_first + id_Print;
  30.   end;
  31.  
  32. { TMyApplication }
  33. procedure TMyApplication.InitMainWindow;
  34. begin
  35.    MainWindow:= new(PMyWindow,init(nil,'Print Example'));
  36. end;
  37.  
  38. { TMyWindow }
  39. constructor TMyWindow.Init(AParent: PWindowsObject; ATitle: PChar);
  40. begin
  41.   TWindow.Init(AParent, ATitle);
  42. end;
  43.  
  44. procedure TMyWindow.GetWindowClass(var AWndClass : TWndClass);
  45. begin
  46.   TWindow.GetWindowClass(AWndClass);
  47.   AWndClass.lpszMenuName := 'MyMenu';
  48. end;
  49.  
  50. procedure TMyWindow.PrintIT(var Msg : TMessage);
  51. var
  52.   hBmp:hBitMap;
  53. begin
  54.   hBmp:= LoadBitmap(hInstance, 'Nolimit');
  55.   if hBMP<>0 then
  56.   PrintBitmap(HWindow, hBmp) else
  57.   MessageBox(HWindow, 'BitMap Not Found', 'Error', MB_ok);
  58. end;
  59.  
  60. { Main }
  61. var
  62.   MyApp: TMyApplication;
  63. begin
  64.   MyApp.Init('MyProgram');
  65.   MyApp.Run;
  66.   MyApp.Done;
  67. end.